

/**
 * @author Charles Huang
 */
public class Commander
{
	private String Name;
	private int powerCost, powerpoints;
	private int moveMod;
	private double defenseMod;
	private double attackMod;
	private boolean power;
	
	/**
	 * Constructor for the Commander class
	 * Sets values to defaults
	 */
	public Commander()
	{
		this.Name = "Commander";
		this.powerCost = 2000;
		this.powerpoints = 0;
		this.moveMod = 0;
		this.defenseMod = 1.0;
		this.attackMod = 1.0;
		this.power = false;
	}
	
	/**
	 * Constructor for the Commander class
	 * @param name - the name of the Commander
	 * @param powerCost - number of PowerPoints needed to activate special power
	 * @param moveMod - modifications to movement speed, a positive <br>
	 * number is a bonus, a negative is a penalty, zero is no change
	 * @param defenseMod - multiplier for damage received, a number < 1 <br>
	 * is a bonus, > 1 is a penalty, and 1 is no change
	 * @param attackMod - multiplier for damage dealt, a number > 1 <br>
	 * is a bonus, a number < 1 is a penalty, and 1 is no change
	 * power boolean indicates if power is on; default is false
	 */
	public Commander(String name, int powerCost, int moveMod, double defenseMod, double attackMod)
	{
		this.Name = name;
		this.powerCost = powerCost;
		this.moveMod = moveMod;
		this.defenseMod = defenseMod;
		this.attackMod = attackMod;
		this.power = false;
	}
	/** 
	 * @return name of the commander
	 */
	public String getName()
	{
		return Name;
	}
	
	public int getPowerCost(){
		return powerCost;
	}
	
	/**
	 * @param Unit - unit whose movement points are being modified
	 * @return moveMod - returns modifications to movement speed, a positive <br>
	 * number is a bonus, a negative is a penalty, zero is no change
	 */
	public int getMoveMod(Unit Unit)
	{
		return moveMod;
	}
	
	/**
	 * @param Target - the defending unit
	 * @param Attacker - the attacking unit
	 * @return defenseMod - returns multiplier for damage received, a number < 1 <br>
	 * is a bonus, > 1 is a penalty, and 1 is no change
	 */
	public double getDefenseMod(Unit Target, Unit Attacker)
	{
		return defenseMod;
	}
	
	/**
	 * @param Attacker - the attacking unit
	 * @param Target - the defending unit
	 * @return attackMod - returns multiplier for damage dealt, a number > 1 <br>
	 * is a bonus, a number < 1 is a penalty, and 1 is no change
	 */
	public double getAttackMod(Unit Attacker, Unit Target)
	{
		return attackMod;
	}
	
	/**
	 * Gives special commander bonuses
	 * @param Attacker - the attacking unit
	 * @param Target - the defending unit, if the target is destroyed
	 */
	public void specialBonus(Unit Attacker, Unit Target)
	{
		return;
	}
	
	/**
	 * sets Movemod
	 * @param moveMod
	 */
	public void setMoveMod(int moveMod)
	{
		this.moveMod = moveMod;
	}
	
	/**
	 * sets defenseMod
	 * @param defenseMod
	 */
	public void setDefenseMod(double defenseMod)
	{
		this.defenseMod = defenseMod;
	}
	
	/**
	 * sets AttackMod
	 * @param attackMod
	 */
	public void setAttackMod(double attackMod)
	{
		this.attackMod = attackMod;
	}
	
	/**
	 * @return power - returns true if power is activated
	 */
	public boolean getPower()
	{
		return power;
	}
	
	/**
	 * Activates the commander's power
	 */
	public void activatePower()
	{
		power = true;
	}
	/**
	 * Deactivates the commander's power
	 */
	public void deactivatePower()
	{
		power = false;
	}

	public void addPoints(int i) {
		powerpoints += i;
	}
}
